package cn.pfz.Service.impl;

import cn.pfz.Service.IBusinessService;
import cn.pfz.domain.Business;
import cn.pfz.domain.SystemDictionaryItem;
import cn.pfz.mapper.BusinessMapper;
import cn.pfz.query.Businessquery;
import cn.pfz.query.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IBusinessServiceimpl implements IBusinessService {
    @Autowired
    private BusinessMapper businessService;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return businessService.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Business record) {
        return businessService.insert(record);
    }

    @Override
    public Business selectByPrimaryKey(Long id) {
        return businessService.selectByPrimaryKey(id);
    }

    @Override
    public List<Business> selectAll() {
        return businessService.selectAll();
    }

    @Override
    public int updateByPrimaryKey(Business record) {
        return businessService.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<Business> list(Businessquery qo) {
        //通过pageHelper进行设置分页及排序
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),"id asc");
        //在Sql中不需要limit
        List<Business> list = businessService.list(qo);
        PageInfo<Business> PageInfo = new PageInfo(list);
        return PageInfo;
    }

    @Override
    public List<Business> selectByMainStore(int i) {
        return businessService.selectByMainStore(i);
    }

}
